help="Don't perform a fetch if we have done so in the last N seconds")
parser.add_argument('--fetch', action='store_true',
help="Also do a git fetch for components")
+ parser.add_argument('-k', '--keep-going', action='store_true',
+ help="Don't exit on fetch failures")
parser.add_argument('components', nargs='*')
args = parser.parse_args(argv)
continue
log("Running git fetch for %s" % (name, ))
- vcs.fetch(self.mirrordir, keytype, uri, branch_or_tag)
+ vcs.fetch(self.mirrordir, keytype, uri, branch_or_tag, keep_going=args.keep_going)
builtins.register(OstbuildGitMirror)
f.close()
return mirror
-def fetch(mirrordir, keytype, uri, branch):
+def fetch(mirrordir, keytype, uri, branch, keep_going=False):
mirror = buildutil.get_mirrordir(mirrordir, keytype, uri)
last_fetch_path = get_lastfetch_path(mirrordir, keytype, uri, branch)
run_sync(['git', 'fetch'], cwd=mirror, log_initiation=False)
- current_vcs_version = run_sync_get_output(['git', 'rev-parse', branch], cwd=mirror)
- current_vcs_version = current_vcs_version.strip()
- f = open(last_fetch_path, 'w')
- f.write(current_vcs_version + '\n')
- f.close()
+ current_vcs_version = run_sync_get_output(['git', 'rev-parse', branch], cwd=mirror,
+ none_on_error=keep_going)
+ if current_vcs_version is not None:
+ current_vcs_version = current_vcs_version.strip()
+ f = open(last_fetch_path, 'w')
+ f.write(current_vcs_version + '\n')
+ f.close()